package com.swq.java.code.chapter11.code05;

import java.io.Serializable;
import java.util.*;

/**
 * 演示静态工厂方法
 */
public class Gender implements Serializable {
    private String description;

    private static final Gender female = new Gender("女");
    private static final Gender male = new Gender("男");

    public String getDescription() {
        return description;
    }

    /**
     * 把构造方法声明为private类型，以便禁止外部程序创建Gender类的实例
     */
    private Gender(String description) {
        this.description = description;
    }

    public static Gender getMale() {
        return male;
    }

    public static Gender getFemale() {
        return female;
    }

}